import org.junit.Test;
import org.openqa.selenium.firefox.FirefoxDriver;


public class kdf2 {
	@Test
	public void KDF(){
		String[][] xTC, xTS;
		String vKW, vxPtah, vTestData;
		FirefoxDriver myd = new FirefoxDriver();
		//Read the entire TC or TS sheet
		
		xTC = readXL("C:/Priya/Silverback 4.3/Automation\QService.xlsx", "TestCases");
		xTS = readXL("C:\Priya\Silverback 4.3\Automation\QService.xlsx", "TestSteps");
		
		//Go to each row in TC and identify which TC to execute
		for(int i=1; i<xTC.length; i++) {   //xtc.lenght will give the number of arrays in a 2 dimensional array
			System.out.println("TCID is" +xTC[i][0]);
			System.out.println("TCID is" + xTC[1][3]);
			
			if (xTC[i][3].equalsIgnoreCase("Y")){  //identify which test case to execute
				System.out.println("Yes this needs to be executed");
				
				//go to corresponding TS in each TS sheet and identify corresponding KW
				for (int j=1; j<xTS.length; j++){
					if(xTC[i][0].equalsIgnoreCase(xTS[j][1]))
						System.out.println("Keyword is" + xTS[j][4]);
					    System.out.println("xPath is"  + xtS[j][5]);
					    System.out.println("Data is " + xTS[j][6])
					    //Call the corresponding keyword function
					    vKW = xTS[j][4];
					    vxPath = xts[j][5];
					    vTestData = xTS[j][6];
					    
					    if (vKW.equalsIgnoreCase("enterText")) {
					    	enterText(myD, vxPath, vtestData)
					    }
					    
					    

					    if (vKW.equalsIgnoreCase("navigateBrowser")) {
					    	enterText(myD, vtestData)
					    }
					    

					    if (vKW.equalsIgnoreCase("clickElement")) {
					    	enterText(myD, vxPath, vtestData)
					    }
					    if (vKW.equalsIgnoreCase("readText")) {
					    	System.out.println( "Test step is a " + readText(myD, vxPath));
					    }
					    
					    if (vKW.equalsIgnoreCase("verifyText")) {
					    	System.out.println( "Test step is a " + verifytext(myD, vxPath, vtestData));
					    }
					}
					}
					    
					    
					}
				
				
			}
		}
		
		
	
		
		// Capture o/p results
	}

}